﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LEET.StaticAnalisys;
using LEET.LEETCommon;

namespace StaticAnalisys.Visitors
{
    public class CompileableEntityCollector : IVisitor
    {
        private IList<String> tests = new List<String>();
        private IList<String> rules = new List<String>();

        public void Visit(INode node)
        {
            switch (node.InstructionType)
            {
                case NodeTypes.EMBED_TYPE: tests.Add(node.Name); break;
                case NodeTypes.RULE_TYPE: foreach(String rule in node.Name.Split('|'))rules.Add(rule.Trim()); break;
            }
        }


        public IEnumerable<String> Tests { get { return tests; } }
        public IEnumerable<String> Rules { get { return rules;  } }
    }
}
